package com.gaswell.canal.impl;

import com.gaswell.canal.Canalinterface;
import com.gaswell.mapper.AlarmRecordMapper;
import com.gaswell.pojo.AlarmRecord;
import com.gaswell.pojo.Diagnosis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @ClassName NullCanalOperator
 * @Author xiaow
 * @DATE 2024/4/7 21:54
 * 数据丢失异常处理   这里要做回溯
 **/
@Component(value = "nullCanalOperator")
public class NullCanalOperator implements Canalinterface {
    @Autowired
    AlarmRecordMapper alarmRecordMapper;
    @Override
    public void operate(Diagnosis diagnosis) {
        AlarmRecord alarmRecord = new AlarmRecord();
        alarmRecord.setAlarm_category("数据丢失");
        alarmRecord.setRecord(diagnosis.getRecord());
        alarmRecord.setJh(diagnosis.getJh());
        alarmRecord.setTime(diagnosis.getCjsj());
        alarmRecordMapper.insert(alarmRecord);
        System.out.println("nullCanalOperator");
    }
}
